import request from '../utils/request'

export function login(username, password) {
    const data = {
        "username": username,
        "password": password
    }
    return request({
        url: '/user/user/login',
        method: 'post',
        data: data
    })
}

export function register(formData) {
    return request({
        url: '/user/user/register',
        method: 'post',
        data: formData
    })
}

export function userPersonalInfo() {
    return request({
        url: '/user/user/personal/info',
        method: 'get',
    })
}

export function getUserById(uId) {
    return request({
        url: '/user/user/' + uId,
        method: 'get',
    })
}

export function updateAvatar(formData) {
    return request({
        url: '/user/user/update/avatar',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    });
}

export function updateInfo(formData) {
    return request({
        url: '/user/user/update/info',
        method: 'post',
        data: formData
    });
}

export function getUserWorks(uid, rule, page, quantity) {
    return request({
        url: '/user/video/user/work',
        method: 'get',
        params: {
            uid : uid,
            rule : rule,
            page : page,
            quantity : quantity
        }
    })
}

export function getWorksCount() {
    return request({
        url: '/user/video/user/works/count',
        method: 'get'
    })
}




